﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ReconSite.Master" AutoEventWireup="true"
    CodeBehind="RemitterMatchInvoice.aspx.cs" Inherits="ReconUI.RemitterMatchInvoice" %>

<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Remitter :: Match Invoices</title>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
     <div class="formDiv" id="formMatchDiv">
    <%--<span title="Invoice List" style="azimuth: left; position: absolute; top: 200px;
        left: 100px; width: 400px;">--%>
        <asp:Label ID="lblInvoiceList" runat="server" Text="List of Invoices:" />
        <div style="height:380px; width:750px; overflow:auto;">
        <asp:GridView ID="grdInvoice" runat="server" AutoGenerateColumns="false"
            Width="750" HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" 
                            HeaderStyle-Font-Bold="false"  
                OnPageIndexChanging="grdInvoice_PageIndexChanging" 
                onrowdatabound="grdInvoice_RowDataBound">
            <EmptyDataTemplate>
                <asp:Label ID="lblNoRows" runat="server" Text="There are no Invoices." />
            </EmptyDataTemplate>
            <Columns>
                <asp:TemplateField>
                <HeaderTemplate>
                                    <input id ="SelectAllCheckBox" type="checkbox" name="SelectAllCheckBox" onclick="javascript:SelectAllStatement(this)">
                           </HeaderTemplate>
                    <ItemTemplate>
                    
                        <asp:Literal ID="ltlInvoiceUniqueID" runat="server" Text='<%# Eval("invoice_unique_id") %>'
                            Visible="false" />
                        <asp:Literal ID="ltlStatementUniqueID" runat="server" Text='<%# Eval("statement_unique_id") %>'
                            Visible="false" />
                        <asp:Literal ID="ltlStatementAmount" runat="server" Text='<%# Eval("statement_amount") %>'
                            Visible="false" />
                        <asp:CheckBox ID="chkSelect" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="Invoice No" DataField="invoice_number" HeaderStyle-Font-Bold = "false"/>
                <asp:BoundField HeaderText="Date" DataField="date" HeaderStyle-Font-Bold = "false"/>
                <asp:BoundField HeaderText="Amount" DataField="amount" HeaderStyle-Font-Bold = "false"/>
                <asp:BoundField HeaderText="Payment Ref No/Cheque No" DataField="ref_no_or_cheque_no" HeaderStyle-Font-Bold = "false"/>
            </Columns>
        </asp:GridView>
        </div>
    <%--</span>--%>
    </div>
    <span title="Statement List" style="azimuth: right; position: absolute; top: 200px;
        right: 100px; width: 400px;">
        <asp:Label ID="lblPaymentReferenceNumber" runat="server" Text="Payment Reference No: "
            AssociatedControlID="txtPaymentReferenceNumber" />
        <br />
        <asp:TextBox ID="txtPaymentReferenceNumber" runat="server" MaxLength="20" />
        <asp:Button ID="btnMarkPayment" runat="server" Text="Mark Payment" OnClick="btnMarkPayment_Click" />
    </span>
    <div style="azimuth: center;">
        <asp:Button ID="btnConfirmMatches" runat="server" Text="Confirm Matches" OnClick="btnConfirmMatches_Click" />
    </div>
     <script type="text/javascript">
         function SelectAllStatement(CheckBoxControl) {
             if (CheckBoxControl.checked == true) {
                 var i;
                 for (i = 0; i < document.forms[0].elements.length; i++) {
                     if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('grdInvoice') > -1)) {
                         document.forms[0].elements[i].checked = true;
                     }
                 }
             }
             else {
                 var i;
                 for (i = 0; i < document.forms[0].elements.length; i++) {
                     if ((document.forms[0].elements[i].type == 'checkbox') &&
                    (document.forms[0].elements[i].name.indexOf('grdInvoice') > -1)) {
                         document.forms[0].elements[i].checked = false;
                     }
                 }
             }
         }
        </script>
</asp:Content>
